<?php

// $Id$

require_once(TANGRA_MAIN_DIR.'interfaces/i_db_storable.class.php');
require_once($WSC->get_site_inc_dir().'modules/tangra_cms/classes/tcms_registry_keys.class.php');
require_once($WSC->get_site_inc_dir().'modules/registry_db/registry_key_db.class.php');


class TCMS_Settings_Visuals_DBC extends Tangra_Class implements I_DB_Storable {
	private $id;
	private $html_tpl_path;


	//fake
	public function set_id($id) {
	}


	//fake
	public function get_id() {
		return 1;
	}


	public function save(DB_Connection $dbc) {
		$this->html_tpl_path->save($dbc);

		return 1;
	}


	public function load_by_id(DB_Connection $dbc, $id) {
		tangra_if_not_int_throw_e($id);

		$html_tpl_path_id = Registry_Key_DB::key_exists($dbc, TCMS_Registry_Keys::KEY_TCMS_VISUALS_HTML_TPL_PATH);
		if ($html_tpl_path_id) {
			$html_tpl_path = new Registry_Key_DB();
			$html_tpl_path->load_by_id($dbc, $html_tpl_path_id);
			$this->html_tpl_path = $html_tpl_path;
		} else {
			throw new Tangra_Module_Exception('Registry key missing: '.TCMS_Registry_Keys::KEY_TCMS_VISUALS_HTML_TPL_PATH);
		}

		return 1;
	}


	public function set_html_resource_path($value) {
		$this->html_tpl_path->set_value($value);
	}


	public function get_html_resource_path() {
		return $this->html_tpl_path->get_value();
	}
}